/**
 * Created by liubin on 2017/6/5.
 */


var DzpkTableRuleLayer = GameCCSBase.extend({
    ctor: function () {
        this._super();
        this.loadCocostudio("res/ccs/DzpkTableRule.json");

        //button
        mo.seekWidgetByName(this.ccsNode, "Panel_touch").addTouchEventListener(function (sender, type) {
            if (mo.gameHelper.getIsTouchEnd(type)) {
                this.setClose();
            }
        }, this);

        //button
        mo.seekWidgetByName(this.ccsNode, "Button_close").addTouchEventListener(function (sender, type) {
            if (mo.gameHelper.getIsTouchEnd(type)) {
                this.setClose();
            }
        }, this);
    },

    onEnter: function () {
        this._super();
    },

    onExit: function () {
        this._super();
    },

    setClose : function(){
        //不需要动画了
        this.removeFromParent();
        return true;
        // var node = mo.seekWidgetByName(this.ccsNode, "Panel_center");
        // var isClose = false;
        //
        // //拦截
        // var currenttime = mo.gameHelper.getMillisecond();
        // if (currenttime - this.mTimestamp < 500){
        //     isClose = false;
        // }else{
        //     this.mTimestamp = currenttime;
        //
        //     var that = this;
        //     node.runAction(cc.sequence(cc.scaleTo(0.3, this.mActionScaleStart), cc.scaleTo(0.1, 0), cc.callFunc(function(){
        //         that.removeFromParent();
        //     })));
        //
        //     isClose = true;
        // }
        //
        // return isClose;
    }
});